<?php 
   //this function formates date according to format argument passed
   function formate_date($data,$time=false,$format='')
   {
     if($data != ""){
		 if($format == '')
		 {
		   
		   $format = 'd-m-Y';
		   
		   if($time == true)
		   {
			 $format .= ' g:i a';
		   }
		 } 
		
		 $formated_date = date($format,strtotime($data)); 
		 return $formated_date;
	 }
   } 
?>
